IF(GLEW_INCLUDE_DIR)
    SET(GLEW_FIND_QUIETLY TRUE)
ENDIF(GLEW_INCLUDE_DIR)

IF(WIN32)
    FIND_PATH(GLEW_INCLUDE_DIR gl/glew.h gl/wglew.h
	      PATHS "c:/glew/"
		    "c:/Program\ Files/Microsoft\ SDKs/Windows/v6.1/Include"
		    "c:/Program\ Files/Microsoft\ Visual\ Studio\ 8/VC/PlatformSDK/Include"
		    "c:/Program\ Files/Microsoft\ Visual\ Studio\ .NET\ 2003/Vc7/Include")
    SET(GLEW_NAMES glew32)
    FIND_LIBRARY(GLEW_LIBRARY
		 NAMES ${GLEW_NAMES}
		 PATHS "c:/glew/lib"
		       "c:/Program\ Files/Microsoft\ SDKs/Windows/v6.1/Lib"
		       "c:/Program\ Files/Microsoft\ Visual\ Studio\ 8/VC/PlatformSDK/Lib"
		       "c:/Program\ Files/Microsoft\ Visual\ Studio\ .NET\ 2003/Vc7/Lib")
ENDIF(WIN32)

GET_FILENAME_COMPONENT(GLEW_LIBRARY_DIR ${GLEW_LIBRARY} PATH)

IF(GLEW_INCLUDE_DIR AND GLEW_LIBRARY)
    SET(GLEW_FOUND TRUE)
    MESSAGE(STATUS "Looking for GLEW Library... - found ${GLEW_LIBRARY_DIR}")
ELSE(GLEW_INCLUDE_DIR AND GLEW_LIBRARY)
    SET(GLEW_FOUND FALSE)
    SET(GLEW_LIBRARY_DIR)
    MESSAGE(FATAL_ERROR "Looking for GLEW Library... - NOT found")
ENDIF(GLEW_INCLUDE_DIR AND GLEW_LIBRARY)

MARK_AS_ADVANCED(
    GLEW_LIBRARY
    GLEW_INCLUDE_DIR
)